package sy.po;

import java.util.List;

import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Index;
import org.nutz.dao.entity.annotation.Many;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.entity.annotation.TableIndexes;

/**
 * 建立了ui_t_company_name唯一键，标识name字段是唯一的
 * 
 * @author 孙宇
 *
 */
@Table("t_company")
@Comment("公司表")
@TableIndexes(@Index(fields = "name", name = "ui_t_company_name", unique = true))
public class Company extends BaseModel {

	@Column
	@Comment("公司名称")
	@ColDefine(notNull = true, width = 100)
	private String name;

	// 用户集合，一个公司有多个用户，一对多关系
	@Many(field = "companyId", target = User.class)
	private List<User> users;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

}
